import IconFont from '../../../pages/editor/flow/common/IconFont';
import {
  UploadOutlined,
  DownOutlined
} from '@ant-design/icons';

export default [{
  title: "组件",
  widgets: [{
    name: "Input",
    text: "输入框",
    icon: <IconFont style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} type={'icon-shurukuang'} />,
    widget: 'input',
    schema: { title: '输入框', type: 'string', widget: 'input' },
    setting: {
      properties: {
        input: {
          title: '输入框',
          type: 'string',
          widget: 'input',
        },
      }
    },
  },
  {
    name: "CheckBox",
    text: "是否选择",
    icon: <IconFont style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} type={'icon-shifouxuanze'} />,
    widget: 'checkbox',
    schema: {
      title: '是否选择', type: 'boolean', widget: 'checkbox',
    },
    setting: {
      isChecked: {
        title: '是否默认勾选',
        type: 'boolean',
      },
    }
  },
  {
    name: "Switch",
    text: "是否Switch",
    icon: <IconFont style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} type={'icon-a-kaiguanguan'} />,
    widget: 'switch',
    schema: { title: '是否选择', type: 'boolean', widget: 'switch' },
    setting: {
      isChecked: {
        title: '是否默认开启',
        type: 'boolean',
      },
    }
  },
  {
    name: "Date",
    text: "日期",
    icon: <IconFont style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} type={'icon-a-date1'} />,
    widget: 'date',
    schema: { title: '日期', type: 'string', widget: 'date' },
    setting: {
    }
  },
  {
    name: "Color",
    text: "颜色选择",
    icon: <IconFont style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} type={'icon-color-picker'} />,
    widget: 'color',
    schema: { title: '日期', type: 'string', widget: 'color' },
    setting: {
    }
  },
  {
    name: "Select",
    text: "下拉单选",
    icon: <DownOutlined style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} />,
    widget: 'select',
    schema: {
      title: '下拉单选', type: 'string', widget: 'select', enumList: true, props: {
        options: [
          {
            label: 'A',
            value: 'A'
          },
          {
            label: 'B',
            value: 'B'
          }
        ],
      }
    },
    setting: {
      defaultValue: {
        title: "默认值",
        type: "string",
        widget: "input",
      },
      dataSourceId: {
        title: "数据源",
        type: "string",
        widget: "select",
        enum: [],
        enumNames: [],
        props: {
          optionFilterProp: "label",
          onChange: () => {
            debugger
          }
        }
      },
      drConfigPanel: {
        title: "选项",
        type: "string",
        buttonContent: "新增一条",
        widget: "drConfigPanel",
      }
    },
  },
  {
    name: "MultiSelect",
    text: "下拉多选",
    icon: <DownOutlined style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} />,
    widget: 'multiSelect',
    schema: {
      title: '多选',
      type: 'array',
      items: {
        type: "string"
      },
      widget: 'multiSelect',
      enumList: true,
      props: {
        options: [
          {
            label: 'A',
            value: 'A'
          },
          {
            label: 'B',
            value: 'B'
          }
        ],
      }
    },
  },
  {
    name: "UploadImg",
    text: "图片上传",
    icon: <UploadOutlined style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} />,
    widget: 'uploadImg',
    schema: {
      title: '图片上传',
      type: 'string',
      widget: 'uploadImg',
    },
  },
  {
    name: "TextEditor",
    text: "编辑器",
    icon: <IconFont style={{ marginRight: '10px', color: 'var(--ant-primary-color)' }} type={'icon-editor-text-color'} />,
    widget: 'textEditor',
    schema: {
      title: '编辑器',
      type: 'string',
      widget: 'textEditor',
    },
  }]
}]
